/* ====================================================================
 * (#)Header: EntityServiceBean.java
 * (#)Revision: 
 * (#)Date Created: 22-Mar-08 5:22:34 PM
 * (#)Created By: Karol Wozniak
 * ====================================================================
 *
 * Copyright (c) 2007 karolak .  All rights reserved.
 *
 * ====================================================================
 * 
 * The software application represented here is the sole property of 
 * karolak. Its unauthorized utilization is expressly prohibited.
 * 
 * ====================================================================
 */
package com.karolak.service.ejb.entity;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.EJB;
import javax.ejb.PostActivate;
import javax.ejb.PrePassivate;
import javax.ejb.Remove;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;

import com.karolak.dao.Dao;
import com.karolak.service.entity.EntityServiceImpl;

/**
 * <code>EntityServiceBean</code> is used to ....
 * 
 * @author <a href="mailto:kwozniak@hotmail.com">Karol Wozniak</a>
 */
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
//TODO review it
public abstract class EntityServiceBean<T, Id> extends EntityServiceImpl<T, Id> {

	public EntityServiceBean(Class<T> persistentClass) {
		super(persistentClass);
	}

	@Override
	@EJB(beanInterface = Dao.class)
	public void setDao(Dao dao) {
		super.setDao(dao);
	}

	// === callbacks === //
	// @Init //only for statefull ?
	public void init() {
		log.debug(this);
	}

	@Remove
	public void remove() {
		log.debug(this);
	}

	@PostConstruct
	public void postConstruct() {
		log.debug(this);
	}

	@PreDestroy
	public void preDestroy() {
		log.debug(this);
	}

	@PrePassivate
	public void prePassivate() {
		log.debug(this);
	}

	@PostActivate
	public void postActivate() {
		log.debug(this);
	}
}
